import Cookies from 'js-cookie'

const TokenKey = 'edu_token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  const num = 24 // 失效时间是几小时
  const time = new Date(new Date().getTime() + num * 60 * 60 * 1000)
  return Cookies.set(TokenKey, token, {
    // 24小时过期时间
    expires: time
  })
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
